package com.itheima.pai.exception.demo02;

import java.util.Scanner;

public class ExceptionDemo01 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请您录入一个分数：");
        String next = sc.next();

        int parseInt = Integer.parseInt(next);
        if(parseInt > 100 || parseInt < 0){

            //直接抛出异常
            throw new ScoreException("你给的分数有误，分数应该在0-100之间");

        }

        //如果程序没有抛出异常，那么给出提示信息
        System.out.println("您的考试分数为：" + parseInt);

    }

}
